 const fs=require('fs');
let rest=fs.readFileSync('persons.json','utf-8')
let obj=JSON.parse(rest)
 let user = { username: "admin3", password: "12345" }; 
 if (obj.find((item) => item.username == user.username)) {
    console.log("该用户已注册");
  } else {
    obj=[...obj,user];
    console.log("注册成功");
    let obj1=JSON.stringify(obj)
    fs.writeFileSync('persons.json',obj1)
  }
  